import Vue from 'vue'
import App from './App.vue'
import router from "./router/index"
import "./assets/css/common.css"
import "./assets/css/reset.css"
// 引入vuex
// import store from "./store/index"
//全局引入mixin
// import mixin from '@/mixin/mixin'

/* import model from '@pages/Test/model/compoment/dialog/index.js'
Vue.use(model) */
import '@pages/Test/model/compoment/dialog/index.js'
import '@pages/Test/model/compoment/model/index.js'

import store from "./stores/index"
import $axios from '@/utils/request';
Vue.prototype.$axios = $axios;

Vue.config.productionTip = false
// 引入jQuery
import $ from 'jquery'



//导入适配
// import 'amfe-flexible'

// 有赞UI库引入
// import Vant from 'vant';
// import 'vant/lib/index.css';
// 全局使用mixin
// Vue.mixin(mixin)
// Vue.use(Vant);

// element组件库的引入
import ElementUI from 'element-ui';
import 'element-ui/lib/theme-chalk/index.css';

// 全局配置 禁止点击遮罩层关闭弹框
ElementUI.Dialog.props.closeOnClickModal.default = false
Vue.use(ElementUI)

// 引入iview组件库
/* import iView from 'iview';
import 'iview/dist/styles/iview.css';    // 使用 CSS
Vue.use(iView) */
//全局过滤器
import * as filters from './filters/index.js'
Object.keys(filters).forEach(key => {
    console.log('key=',key);
    Vue.filter(key, filters[key])
})

// 注册一个全局自定义指令 `v-focus`
Vue.directive('big', function(el,binding){
    console.log('触发了全局指令el',el);
    console.log('触发了全局指令binding',binding);
    el.innerText = binding.value*10
})

Vue.directive('fbind',{
    bind(el,binding){
        el.value = binding.value
    },
    inserted(el) {
        el.focus()
    },
    update(el,binding) {
        el.value = binding.value
    }

})

// markdown样式
import 'github-markdown-css'
// 代码高亮
import 'highlight.js/styles/github.css'

import highlight from 'highlight.js';

Vue.use(highlight);

// 封装成一个指令
Vue.directive('highlight', (el) => {
    let blocks = el.querySelectorAll('pre code')
    blocks.forEach((block) => {
      highlight.highlightBlock(block)
    })})
  
//导入
import PubSub from 'pubsub-js'
//挂载全局
Vue.prototype.PubSub = PubSub



new Vue({
    render: h => h(App),
    router,
    store,
    // jquery,
    // $,
    beforeCreate(){
        Vue.prototype.$bus = this // 全局配置一个事件总线
    }
}).$mount('#app')
